/* 
 * Copyright (C) 2012 UTSChedule
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package utsc.apps.utschedule.ui.activities;

import android.content.Intent;

/**
 * This is a generic activity for form. It has various helper methods for setting up the form.
 *
 */
public abstract class GenericFormActivity<T> extends GenericFragmentActivity {
	
	/**
	 * Setup the basic resources of the form, this method should be called when
	 * you initialize the form.
	 */
	protected abstract void setupBasicResources();
	
	/**
	 * Setup the form for a new entry.
	 * @param requestIntent -the request intent of the activity
	 */
	protected abstract void setupResourcesForNew(Intent requestIntent);
	
	/**
	 * Setup the form for an update.
	 * @param requestIntent -the request intent of the activity
	 */
	protected abstract void setupResourcesForUpdate(Intent requestIntent);
	
	protected int _requestCode;
	
	/**
	 * The form validation method, this method is supposed to be called before
	 * you save anything to the database.
	 * 
	 * @param object -the object to be validated
	 * @return true if validation is passed, otherwise, false
	 */
	protected abstract boolean validate(T object);
	
}
